import React, { useState } from 'react'
import { useEffect } from 'react';
import Offline from './components/offline';
import { fetchUserBuyGoodsDetail } from '@/server/shop';
import { getCurrentInstance, useReachBottom } from '@tarojs/taro'
import { loginData } from '@/utils/utils'
import './index.scss'
const VideoDetails = (props) => {
  const { params } = getCurrentInstance().router
  const { goodsId = '' } = params
  const { organizationId = '1' } = loginData() || {}
  const [data, setData] = useState({})
  const { goodsBaseInfo = {} } = data
  const { goodsType = 'offline' } = goodsBaseInfo
  useEffect(() => {
    fetchData()
  }, [])

  const fetchData = () => {
    fetchUserBuyGoodsDetail({ organizationId, goodsId }).then(e => {
      setData(e)
    })
  }
  return <Offline data={data}></Offline>
}
export default VideoDetails